// 封装获取频道的逻辑
import { getChannelAPI } from "../apis/article";
import { useState, useEffect } from "react";

export const useChannel = () => {
  const [channels, setChannels] = useState([]);
  const fetchChannels = async () => {
    const res = await getChannelAPI();
    setChannels(res.data.channels);
  };
  useEffect(() => {
    fetchChannels();
  }, []);
  return {
    channels
  }
};
